package com.example.springbootv1.controller;

import com.example.springbootv1.pojo.SySRole;
import com.example.springbootv1.service.SysRoleService;
import com.example.springbootv1.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sysRole")
@CrossOrigin("*")
public class SysRoleController {
    @Autowired
    private SysRoleService sysRoleService;

    @PostMapping("/getList")
    public Result getList(@RequestBody SySRole sysRole) {
        System.out.println("------"+sysRole+"----------");
        return Result.success(sysRoleService.getList(sysRole));
    }

    @PostMapping("/insert")
    public Result insert(@RequestBody SySRole sysRole) {
        System.out.println("insert----"+sysRole+"----------");
        return Result.success(sysRoleService.insert(sysRole));
    }
    @DeleteMapping("/deleteById/{id}")
    public Result deleteById(@PathVariable("id") Long id) {
        return Result.success(sysRoleService.deleteById(id));
    }
}
